/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package televisao;

import java.util.ArrayList;
import java.util.List;
import javax.swing.JOptionPane;

/**
 *
 * @author Aluno
 */
public class TelaAtor extends javax.swing.JFrame {

    int posicao = 0;
    /**
     * Creates new form TelaAtor
     */
    List<Ator> lista;

    public TelaAtor() {
        lista = new ArrayList<Ator>();
        initComponents();
    }

    public void Limpar() {
        txtnome.setText("");
        txtdatanasc.setText("");
        txtqtdnov.setText("");
        txtemail.setText("");
        txtnomeart.setText("");
        txtsal.setText("");
        txtcache.setText("");
        txtcidade.setText("");
        txtbairro.setText("");
        //txtganhos.setText("");
        txtestado.setSelectedIndex(0);

    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        jLabel9 = new javax.swing.JLabel();
        jLabel10 = new javax.swing.JLabel();
        jLabel12 = new javax.swing.JLabel();
        txtnome = new javax.swing.JTextField();
        txtdatanasc = new javax.swing.JTextField();
        txtqtdnov = new javax.swing.JTextField();
        txtemail = new javax.swing.JTextField();
        txtnomeart = new javax.swing.JTextField();
        txtsal = new javax.swing.JTextField();
        txtcache = new javax.swing.JTextField();
        txtcidade = new javax.swing.JTextField();
        txtbairro = new javax.swing.JTextField();
        txtestado = new javax.swing.JComboBox();
        txtcadastrar = new javax.swing.JButton();
        txtlimpar = new javax.swing.JButton();
        txtexcluir = new javax.swing.JButton();
        txtconsultar = new javax.swing.JButton();
        jPanel1 = new javax.swing.JPanel();
        txtprimeiro = new javax.swing.JButton();
        txtanterior = new javax.swing.JButton();
        txtproximo = new javax.swing.JButton();
        txtultimo = new javax.swing.JButton();
        txtstatus = new javax.swing.JButton();
        txtganhos = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        jLabel1.setText("ATOR");

        jLabel2.setText("NOME");

        jLabel3.setText("DATA DE NASCIMENTO");

        jLabel4.setText("QUANTIDADE DE NOVELAS");

        jLabel5.setText("EMAIL");

        jLabel6.setText("NOME ARTÍSTICO");

        jLabel7.setText("SALÁRIO");

        jLabel8.setText("CACHÊ");

        jLabel9.setText("CIDADE");

        jLabel10.setText("BAIRRO");

        jLabel12.setText("ESTADO");

        txtnome.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtnomeActionPerformed(evt);
            }
        });

        txtcache.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtcacheActionPerformed(evt);
            }
        });

        txtcidade.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtcidadeActionPerformed(evt);
            }
        });

        txtestado.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Selecione", "RS", "SC", "PR" }));
        txtestado.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtestadoActionPerformed(evt);
            }
        });

        txtcadastrar.setText("CADASTRAR");
        txtcadastrar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtcadastrarActionPerformed(evt);
            }
        });

        txtlimpar.setText("LIMPAR");
        txtlimpar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtlimparActionPerformed(evt);
            }
        });

        txtexcluir.setText("EXCLUIR");
        txtexcluir.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtexcluirActionPerformed(evt);
            }
        });

        txtconsultar.setText("CONSULTAR");
        txtconsultar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtconsultarActionPerformed(evt);
            }
        });

        jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Navegação"));
        jPanel1.setForeground(new java.awt.Color(102, 102, 102));

        txtprimeiro.setText("PRIMEIRO");
        txtprimeiro.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtprimeiroActionPerformed(evt);
            }
        });

        txtanterior.setText("ANTERIOR");
        txtanterior.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtanteriorActionPerformed(evt);
            }
        });

        txtproximo.setText("PRÓXIMO");
        txtproximo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtproximoActionPerformed(evt);
            }
        });

        txtultimo.setText("ÚLTIMO");
        txtultimo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtultimoActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(21, 21, 21)
                .addComponent(txtprimeiro)
                .addGap(74, 74, 74)
                .addComponent(txtanterior)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 83, Short.MAX_VALUE)
                .addComponent(txtproximo)
                .addGap(89, 89, 89)
                .addComponent(txtultimo)
                .addGap(70, 70, 70))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(35, 35, 35)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtprimeiro)
                    .addComponent(txtanterior)
                    .addComponent(txtproximo)
                    .addComponent(txtultimo))
                .addContainerGap(26, Short.MAX_VALUE))
        );

        txtstatus.setText("STATUS");
        txtstatus.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtstatusActionPerformed(evt);
            }
        });

        txtganhos.setText("GANHOS");
        txtganhos.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtganhosActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(69, 69, 69)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel12)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                        .addComponent(jLabel10)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel8)
                            .addComponent(jLabel9)))
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(jLabel1, javax.swing.GroupLayout.Alignment.TRAILING)
                        .addGroup(layout.createSequentialGroup()
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(jLabel2)
                                .addComponent(jLabel4)
                                .addComponent(jLabel3)
                                .addComponent(jLabel5)
                                .addComponent(jLabel6)
                                .addComponent(jLabel7))
                            .addGap(22, 22, 22)
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                .addComponent(txtestado, 0, 244, Short.MAX_VALUE)
                                .addComponent(txtqtdnov, javax.swing.GroupLayout.Alignment.TRAILING)
                                .addComponent(txtnome)
                                .addComponent(txtnomeart, javax.swing.GroupLayout.Alignment.TRAILING)
                                .addComponent(txtsal, javax.swing.GroupLayout.Alignment.TRAILING)
                                .addComponent(txtbairro, javax.swing.GroupLayout.Alignment.TRAILING)
                                .addComponent(txtcidade, javax.swing.GroupLayout.Alignment.TRAILING)
                                .addComponent(txtcache, javax.swing.GroupLayout.Alignment.TRAILING)
                                .addComponent(txtdatanasc)
                                .addComponent(txtemail, javax.swing.GroupLayout.DEFAULT_SIZE, 244, Short.MAX_VALUE)))))
                .addGap(93, 93, 93)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(txtconsultar, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(txtcadastrar, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(txtexcluir, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addGap(64, 64, 64)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(txtlimpar)
                    .addComponent(txtganhos)
                    .addComponent(txtstatus))
                .addContainerGap(96, Short.MAX_VALUE))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap(133, Short.MAX_VALUE)
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(82, 82, 82))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(35, 35, 35)
                .addComponent(jLabel1)
                .addGap(53, 53, 53)
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 29, Short.MAX_VALUE)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jLabel2)
                        .addGap(88, 88, 88))
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(txtnome, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(18, 18, 18)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(txtdatanasc, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jLabel3)))
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                                .addGap(16, 16, 16)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(txtconsultar)
                                    .addComponent(txtstatus))))
                        .addGap(18, 18, 18)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel4)
                            .addComponent(txtqtdnov, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addGap(20, 20, 20)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel5)
                    .addComponent(txtemail, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(txtcadastrar)
                    .addComponent(txtganhos))
                .addGap(21, 21, 21)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel6)
                    .addComponent(txtnomeart, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(21, 21, 21)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel7)
                            .addComponent(txtsal, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(29, 29, 29)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(txtexcluir)
                            .addComponent(txtlimpar))))
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(18, 18, 18)
                        .addComponent(jLabel8))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(18, 18, 18)
                        .addComponent(txtcache, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel9)
                    .addComponent(txtcidade, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(28, 28, 28)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtbairro, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel10))
                .addGap(26, 26, 26)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtestado, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel12))
                .addGap(175, 175, 175))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void txtestadoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtestadoActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_txtestadoActionPerformed

    private void txtnomeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtnomeActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_txtnomeActionPerformed

    private void txtcidadeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtcidadeActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_txtcidadeActionPerformed

    private void txtcacheActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtcacheActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_txtcacheActionPerformed

    private void txtcadastrarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtcadastrarActionPerformed

        Ator ator = new Ator();
        ator.setBairro(txtbairro.getText());
        ator.setCache_part(Double.parseDouble(txtcache.getText()));
        ator.setCidade(txtcidade.getText());
        ator.setDat_nas(txtdatanasc.getText());
        ator.setEmail(txtemail.getText());
        ator.setEstado(txtestado.getSelectedItem().toString());
        ator.setNome(txtnome.getText());
        ator.setNome_art(txtnomeart.getText());
        ator.setQtd_nov(Integer.parseInt(txtqtdnov.getText()));
        ator.setSal_mensal(Double.parseDouble(txtsal.getText()));

        lista.add(ator);
        Limpar();
        if (txtbairro.equals(null) || txtcache.equals(null) || txtcidade.equals(null) || txtdatanasc.equals(null) || txtemail.equals(null) || txtestado.equals("Selecione") || txtnome.equals(null) || txtnomeart.equals(null) || txtqtdnov.equals(null) || txtsal.equals(null)) {
            JOptionPane.showMessageDialog(null, "Preencha todos os campos primeiro!");
        } else {
            JOptionPane.showMessageDialog(null, "Ator cadastrado com sucesso!");
        }
        posicao++;
    }//GEN-LAST:event_txtcadastrarActionPerformed

    private void txtlimparActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtlimparActionPerformed
        Limpar();
    }//GEN-LAST:event_txtlimparActionPerformed

    private void txtexcluirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtexcluirActionPerformed
        
        lista.remove(lista.get(posicao));
        Limpar(); 
        JOptionPane.showMessageDialog(null, "Dados do ator excluídos com sucesso");
    }//GEN-LAST:event_txtexcluirActionPerformed

    private void txtconsultarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtconsultarActionPerformed
        String nome = JOptionPane.showInputDialog("Digite o nome a ser pesquisado:");
        boolean encontrou = false;
        int posicaoachou = 0;
    }//GEN-LAST:event_txtconsultarActionPerformed

    private void txtstatusActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtstatusActionPerformed
        Ator ator = lista.get(posicao);
        String status = ator.Status();
        JOptionPane.showMessageDialog(null, "O status do ator é" + status);
    }//GEN-LAST:event_txtstatusActionPerformed

    private void txtganhosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtganhosActionPerformed

        Ator ator = lista.get(posicao);
        JOptionPane.showMessageDialog(null, "Os ganhos total do ator é:" + ator.Ganhos(ator.getSal_mensal()));
    }//GEN-LAST:event_txtganhosActionPerformed

    private void txtprimeiroActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtprimeiroActionPerformed
        txtprimeiro.setEnabled(true);
        txtanterior.setEnabled(false);
        txtproximo.setEnabled(true);
        txtultimo.setEnabled(true);

        //pegar o primeiro elemento da lista:
        if (lista.size() > 0) {
            Ator elemento = lista.get(0);
            posicao = 0;
            
            txtnome.setText(elemento.getNome());
            txtdatanasc.setText(elemento.getDat_nas());
            txtqtdnov.setText(elemento.getQtd_nov().toString());
            txtemail.setText(elemento.getEmail());
            txtnomeart.setText(elemento.getNome_art());
            txtsal.setText(elemento.getSal_mensal().toString());
            txtcidade.setText(elemento.getCidade());
            txtbairro.setText(elemento.getBairro());
            txtcache.setText(String.valueOf(elemento.getCache_part()));
            if (elemento.getEstado().equals("RS")) {
                txtestado.setSelectedIndex(1);
            } else if (elemento.getEstado().equals("SC")) {
                txtestado.setSelectedIndex(2);
            } else {
                txtestado.setSelectedIndex(3);
            }
        }
        if (lista.size() == 1) {
            txtanterior.setEnabled(false);
            txtproximo.setEnabled(false);
        }
    }//GEN-LAST:event_txtprimeiroActionPerformed

    private void txtanteriorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtanteriorActionPerformed
        txtprimeiro.setEnabled(true);
        txtanterior.setEnabled(true);
        txtproximo.setEnabled(true);
        txtultimo.setEnabled(true);
        
        if (posicao > 0) {
            posicao = posicao - 1;
            Ator elemento = lista.get(posicao);
                txtnome.setText(elemento.getNome());
                txtdatanasc.setText(elemento.getDat_nas());
                txtqtdnov.setText(elemento.getQtd_nov().toString());
                txtemail.setText(elemento.getEmail());
                txtnomeart.setText(elemento.getNome_art());
                txtsal.setText(elemento.getSal_mensal().toString());
                txtcidade.setText(elemento.getCidade());
                txtbairro.setText(elemento.getBairro());
                txtcache.setText(String.valueOf(elemento.getCache_part()));
                if (elemento.getEstado().equals("RS")) {
                    txtestado.setSelectedIndex(1);
                } else if (elemento.getEstado().equals("SC")) {
                    txtestado.setSelectedIndex(2);
                } else {
                    txtestado.setSelectedIndex(3);
                }
                posicao++;
            }
        if(lista.size()== 1){
            txtproximo.setEnabled(false);
        }
    }//GEN-LAST:event_txtanteriorActionPerformed

    private void txtproximoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtproximoActionPerformed
        txtprimeiro.setEnabled(true);
        txtanterior.setEnabled(true);
        txtproximo.setEnabled(true);
        txtultimo.setEnabled(true);
        
        posicao = posicao + 1;
        Ator elemento = lista.get(posicao);
        if (posicao > 0) {
            if (lista.size() > 0) {

                txtnome.setText(elemento.getNome());
                txtdatanasc.setText(elemento.getDat_nas());
                txtqtdnov.setText(elemento.getQtd_nov().toString());
                txtemail.setText(elemento.getEmail());
                txtnomeart.setText(elemento.getNome_art());
                txtsal.setText(elemento.getSal_mensal().toString());
                txtcidade.setText(elemento.getCidade());
                txtbairro.setText(elemento.getBairro());
                txtcache.setText(String.valueOf(elemento.getCache_part()));
                if (elemento.getEstado().equals("RS")) {
                    txtestado.setSelectedIndex(1);
                } else if (elemento.getEstado().equals("SC")) {
                    txtestado.setSelectedIndex(2);
                } else {
                    txtestado.setSelectedIndex(3);
                }
                posicao++;
            }
        }
    }//GEN-LAST:event_txtproximoActionPerformed

    private void txtultimoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtultimoActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_txtultimoActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(TelaAtor.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(TelaAtor.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(TelaAtor.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(TelaAtor.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new TelaAtor().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JButton txtanterior;
    private javax.swing.JTextField txtbairro;
    private javax.swing.JTextField txtcache;
    private javax.swing.JButton txtcadastrar;
    private javax.swing.JTextField txtcidade;
    private javax.swing.JButton txtconsultar;
    private javax.swing.JTextField txtdatanasc;
    private javax.swing.JTextField txtemail;
    private javax.swing.JComboBox txtestado;
    private javax.swing.JButton txtexcluir;
    private javax.swing.JButton txtganhos;
    private javax.swing.JButton txtlimpar;
    private javax.swing.JTextField txtnome;
    private javax.swing.JTextField txtnomeart;
    private javax.swing.JButton txtprimeiro;
    private javax.swing.JButton txtproximo;
    private javax.swing.JTextField txtqtdnov;
    private javax.swing.JTextField txtsal;
    private javax.swing.JButton txtstatus;
    private javax.swing.JButton txtultimo;
    // End of variables declaration//GEN-END:variables
}
